package com.jinchengll.xigua.ui.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.jinchengll.xigua.R;
import com.jinchengll.xigua.ui.base.BaseFragment;

public class BlankFragment extends BaseFragment {

    private TextView textView;
    private String title;

    public BlankFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // 恢复现场数据
        if (savedInstanceState != null)
            title = savedInstanceState.getString("title");
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    public BlankFragment(String title) {
        this.title = title;
    }

    public static BlankFragment newInstance(String title) {
        return new BlankFragment(title);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initView(View view) {
        textView = view.findViewById(R.id.blankText);
        textView.setText(title);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.blank_fragment;
    }

    @Override
    public void onSaveInstanceState(Bundle outState) {
        super.onSaveInstanceState(outState);
        outState.putString("title", title);
    }
}